/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 杨已萱
 * Date: 2023-04-16
 * Time: 18:06
 */
class MyArray{
    public Object[] objects = new Object[4];

//    public Object[] getObjects() {
//        return objects;
//    }
//    public void setObjects(Object[] objects) {
//        this.objects = objects;
//    }
    public Object getpos(int pos){
        return objects[pos];
    }
    public void setpos(int pos , Object value){
        objects[pos] = value;
    }
}
public class Test {
    public static void main(String[] args) {
        MyArray myArray = new MyArray();
        myArray.setpos(0,10);
        myArray.setpos(1,"hha");
        myArray.setpos(2,10.0009);
        myArray.setpos(3,true);
        Object getpos1 = myArray.getpos(2);
        System.out.println(getpos1);
        Double str2 = (Double)myArray.getpos(2);//左边是String 右边是Object需要强转
        System.out.println(str2);


//        myArray.setObjects();
    }

}
